package cn.leida.ruoyi.system.dao;

import cn.leida.ruoyi.system.domain.SysLoginInfor;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 系统访问日志情况信息 数据层
 *
 * @author liutietou
 * @since 1.0  2020-12-11
 */
@Repository
public interface SysLoginInforDao extends JpaRepository<SysLoginInfor, Long>, JpaSpecificationExecutor<SysLoginInfor> {

    void deleteAllByInfoIdIn(List<Long> ids);

    @Modifying
    @Query(value = "truncate table sys_login_infor", nativeQuery = true)
    void truncateTable();

    @Modifying
    @Query(value = " delete from sys_login_infor where login_time < ?1 ", nativeQuery = true)
    void deleteSysLoginInfor(String loginDay);

}
